<?php

/**
 * Created by PhpStorm.
 * User: Hasche
 * Date: 11/19/14
 * Time: 9:40 AM
 */
class GL_User extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $data['layout_count'] = $this->product->count_pending();
        $data['layout_pending'] = $this->product->get_all_pending();
        $this->layout->setLayout("admin/layout", $data);
        if ($this->permission() != 0) redirect('../');
    }

    public function index()
    {
        $data['admins'] = $this->user->get_admin();
        $data['users'] = $this->user->get_user();
        $data['authors'] = $this->user->get_author();
        $this->layout->view("admin/user", $data);
    }
    function make_admin(){
        $this->user->edit_permission($this->input->post('id'),0);
        echo 1;
    }

    function remove_admin(){
        $this->user->edit_permission($this->input->post('id'),1);
        echo 1;
    }


}